package behavioral_pattern.mediator_pattern;




public class ConcreteMediator extends Mediator{

    public Button addButton;
    public List list;
    public TextBox userNameTextBox;
    public ComboBox comboBox;


    @Override
    public void componentChanged(Component component) {
         //单击按钮
        if (component == addButton){
            System.out.println("---单击增加按钮---");
            list.update();
            comboBox.select();
            userNameTextBox.update();
        }else  if (component == list){
            System.out.println("---从列表框选择客户---");
            comboBox.select();
            userNameTextBox.setText();
        }else  if (component == comboBox){
            System.out.println("---从组合框选择客户---");
            comboBox.select();
            userNameTextBox.setText();
        }
    }
}
